<?php
	/* ******************************************************** */
	/* Arcans Project (2010)                                    */
	/* Jeu sous forme d'application web entièrement conçu       */
	/* et réalisé par Killian Le Maitre                         */
	/* Jeu sous licence GNU GPL v3 (voir NOTICE et COPYING)     */
	/* ******************************************************** */

	//*********************************
	//classe de création du header html
	//*********************************
	class HeaderClass {
		//propriétés :
		private $title;
		private $charset;
		private $style;
		//méthodes :
		function __construct($type, $obj_xml, $title, $infos) {
			$this->title = $infos["title"]." - ".$title;
			$this->charset = $infos["charset"];
			$this->style = $infos["style"];
			if ($type == "classic") $this->infos = $obj_xml;
			elseif ($type == "panel") $this->infos = "panel";
		}
		public function affichage() {
			echo '<title>'.$this->title.'</title>';
			echo '<meta http-equiv="Content-Type" content="text/html; charset='.$this->charset.'" />';
			echo '<meta http-equiv="pragma" content="no-cache">';
			echo '<link type="text/css" rel="stylesheet" href="'.$this->style.'" />';
			if ($this->infos == "panel") {
				echo '<script type="text/javascript" src="javascript/panel.js"></script>';
				echo '<script type="text/javascript" src="javascript/chat.js"></script>';
				echo '<script type="text/javascript" src="javascript/imail.js"></script>';
			}
			else {
				echo '<meta http-equiv="refresh" content="2000;url=?p=i" />';
				echo '<script type="text/javascript" src="javascript/onload.js"></script>';
				echo '<script type="text/javascript" src="javascript/bao.js"></script>';
				if ($this->infos[0]["type"] != "noinfos") $this->infosAff();
				if (isset($_SESSION["pseudo"])) {
					echo '<script type="text/javascript" src="javascript/decon.js"></script>';
					echo '<script type="text/javascript" src="javascript/messages.js"></script>';
					echo '<script type="text/javascript" src="javascript/chat.js"></script>';
					echo '<script type="text/javascript" src="javascript/imail.js"></script>';
				}
				else {
					echo '<script type="text/javascript" src="javascript/login.js"></script>';
				}
			}
		}
		private function infosAff() {
			foreach ($this->infos as $elt) {
				switch ($elt["type"]) {
					case "javascript" : echo '<script type="text/javascript" src="javascript/'.$elt["path"].'"></script>'; break;
				}
			}
		}
	}
	//******************************
	//classe de création de l'entete
	//******************************
	class EnteteClass {
		//propriétés :
		private $E_title;
		private $E_subtitle;
		//méthodes :
		function __construct() {
			$this->E_title = "Arcans Project";
			$this->E_subtitle = "Tactical RPG par navigateur";
		}
		public function affichage() {
			echo '<td id="logo1">&nbsp;</td><td id="titletd"><a href="?p=i">'.$this->E_title.'</a><br />';
			echo $this->E_subtitle.'</td>';
		}
	}
?>